﻿/*
 *	CriticalSection.h
 *
 *  Created 2017年4月1日
 *  Author: wangwei
 */
#ifndef COMMON_MUTEX_HH
#define COMMON_MUTEX_HH

#include "sys_inc.h"

class CriticalSection
{
public:
	CriticalSection(void);

	virtual ~CriticalSection(void);

	virtual void enter_mutex();

	virtual void leave_mutex();

protected:
#ifndef WIN32
	pthread_mutex_t		m_event_mutex;
#else
	CRITICAL_SECTION	m_event_mutex;
#endif // WIN32
};

class CGuardMutex
{
public:
	CGuardMutex(CriticalSection &cirt) ;
	virtual ~CGuardMutex();
private:
	CriticalSection& m_stCS;
};

#endif /* COMMON_MUTEX_H_ */
